package com.my.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.my.entity.Subject;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SubjectMapper extends BaseMapper<Subject> {

    @Select("SELECT s.id, s.`deep`, s.`name`, s.`parent_id`, s.`remarks`, s.`sort`, s.`create_time`, p.`name` AS parent_name FROM `subject` s LEFT JOIN `subject` p ON p.id = s.`parent_id`")
    List<Subject> getList();

}
